package com;

import org.junit.jupiter.api.Test;
import redis.clients.jedis.HostAndPort;
import redis.clients.jedis.Jedis;
import redis.clients.jedis.JedisCluster;
import redis.clients.jedis.JedisPoolConfig;

import java.util.HashSet;
import java.util.Set;

public class test {
    @Test
    public void JedisConn(){
        JedisPoolConfig config = new JedisPoolConfig();
        Set<HostAndPort> jedisClusterNode = new HashSet<HostAndPort>();
        jedisClusterNode.add(new HostAndPort("192.168.80.3", 7001));
        jedisClusterNode.add(new HostAndPort("192.168.80.3", 7002));
        jedisClusterNode.add(new HostAndPort("192.168.80.3", 7003));
        jedisClusterNode.add(new HostAndPort("192.168.80.3", 7004));
        jedisClusterNode.add(new HostAndPort("192.168.80.3", 7005));
        jedisClusterNode.add(new HostAndPort("192.168.80.3", 7006));
        JedisCluster jcd = new JedisCluster(jedisClusterNode, config);
        jcd.set("name:001","scb");
        String value = jcd.get("name:001");
        System.out.println(value);
    }
}
